#pragma once
////#include "stdafx.h"
#include "am.h"
#include "LPSmodel.h"
#include "Space.h"
#include "Vector.h"
#include "SpaceAgent.h"
namespace LPS
{
	using namespace org::spark::core;
	using namespace org::spark::data;
	using namespace org::spark::space;
	//using namespace org::spark::utils;
	using namespace org::spark::math;

	void am::_init()
	{
	}

	am::am()
	{
		_init();
	}

	void am::amFunction()
	{
		this->wiggle(1.0);
		this->sniff(LPSmodel::LPS, 0.0);
		LPSmodel::pro->addValue(this, (0.5 / (0.1 + (LPSmodel::anti->getValue(this) * 100.0))));
		LPSmodel::anti->addValue(this, ((0.1 * LPSmodel::macAnti) / (1.0 + LPSmodel::anti->getValue(this))));
		this->age -= 1.0;
		if ((this->age < 0.0))
		{
			this->die();
		}
		if ((LPSmodel::anti->getValue(this) > LPSmodel::antiHealThresh))
		{
			mac *_agent;
			_agent = new mac();
			_agent->moveToSpace(this->getSpace(), this->getPosition());
			if (_agent != 0)
			{
				mac *__agent3 = _agent;
				__agent3->age = this->age;
				if ((__agent3->age > LPSmodel::macAge))
				{
					__agent3->age = (__agent3->age - LPSmodel::macAge);
				}
				//__agent3->setColor((std::vector(204.0 / 255.0, 102.0 / 255.0, 0)));
				__agent3->activated = false;
			}
			this->die();
			return;
		}
	}
}
